package gui;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.net.URL;

import javax.swing.*;

import components.register.RegisterGroup;

public class NextButton extends JButton {
	public int timesOfClicked;
	public ImageIcon icon1, icon2;
	public boolean isOn;

	public NextButton() {
		timesOfClicked = 0;
	}

	public NextButton(String s1, String s2) {
		timesOfClicked = 0;
		isOn = false;
		
		URL url1 = TestMain.class.getResource(TestMain.imgDir + s1);
		URL url2 = TestMain.class.getResource(TestMain.imgDir + s2);

		icon1 = new ImageIcon(url1);
		icon2 = new ImageIcon(url2);
		
		
		this.setIcon(icon1);
		this.setContentAreaFilled(false);
		this.setBorder(null);
		this.setOpaque(false);

		this.addMouseListener(new MouseListener() {

			@Override
			public void mouseClicked(MouseEvent e) {

				if (PowerButton.isOn == true) {
					isOn = true;
				}
			}

			@Override
			public void mousePressed(MouseEvent e) {
				// TODO Auto-generated method stub
				if (PowerButton.isOn == true) {
					setIcon(icon2);
				}
			}

			@Override
			public void mouseReleased(MouseEvent e) {
				// TODO Auto-generated method stub
				if (PowerButton.isOn == true) {
					setIcon(icon1);
				}
			}

			@Override
			public void mouseEntered(MouseEvent e) {
				// TODO Auto-generated method stub
			}

			@Override
			public void mouseExited(MouseEvent e) {
				// TODO Auto-generated method stub
			}

		});
	}

	public int getTimesOfClicked() {
		return timesOfClicked;
	}

	public void setTimesOfClicked(int i) {
		timesOfClicked = i;
	}

}
